import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: () => import('@/views/login.vue')
};
export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('@/views/ui-layout/lockscreen/components/locking-page.vue')
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
      { path: 'home', title:'首页', name: 'home_index', component: () => import('@/views/pages/home/home.vue') },
      { path: 'own', title: '个人中心', name: 'own_index', component: () => import('@/views/pages/own/own.vue') },
      { path: '/404', title: '404-页面不存在', name: 'error-404',   component: () => import('@/views/pages/errors/404.vue') },
      { path: '/403',title:'403-权限不足',name:'error-403', component: () => import('@//views/pages/errors/403.vue')},
      { path:'/500',title:'500-服务端错误',name:'error-500',component: () => import('@/views/pages/errors/500.vue')},
      { path: 'addUser', title: '新增用户', name: 'addUser_index', component: () => import('@/views/pages/sys/user/addUser.vue') },//
      { path: 'addRole', title: '新增角色', name: 'addRole_index', component: () => import('@/views/pages/sys/role/addRole.vue') }//
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
  {
    path: '/sys',
    icon: 'android-settings',
    name: 'sys',
    title: '系统管理',
    component: Main,
    children: [
      { path: 'dept', title: '部门管理', name: 'dept', component: () => import('@/views/pages/sys/dept/deptList.vue')},
      { path: 'user', title: '用户管理', name: 'user', component: () => import('@/views/pages/sys/user/userList.vue')},
    ]
  }
];
// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    locking,
    ...appRouter
];
